// 用户信息专用接口
import request from '@/utils/request'
// 获取当前用户信息
export const getInfo = () => {
  return request.get('/normal/show/message')
}

// 修改个人密码

export const updatePwd = ({ newPwd, oldPwd, surePwd }) => {
  return request.post('/normal/update/pwd', { newPwd, oldPwd, surePwd })
}

// 修改头像
// export const updateAvatar = (playload) => {
//   return request.post('/normal/update/avatar', playload, {
//     headers: {
//       'Content-Type': 'application/x-www-form-urlencoded'
//     }
//   })
// }
// 修改头像
export const updateAvatar = {
  uploadFile (playload) {
    return request.post('/normal/update/avatar', playload, {
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
      }

    })
  }
}

// 忘记密码--发送邮箱验证码

export const getEmail = ({ email }) => {
  return request.get('/normal/email/code', {
    params: {
      email
    }
  })
}

// 忘记密码---对验证码进行验证

export const verifyCode = ({ code, email }) => {
  return request.get('/normal/email/verify', {
    params: {
      email,
      code
    }
  })
}
// 新增后台人员-邮件-连接验证-是否失效 格式是否正确
export const emailVerify = (email) => {
  return request.get(`/normal/email/verify/${email}`)
}

// 设置新密码---注册
export const setPwd = ({ email, ppwd, pwd }) => {
  return request.post('/normal/email/pwd', { email, ppwd, pwd })
}

// 设置新密码--忘记密码时
export const setNewPwd = ({ email, ppwd, pwd }) => {
  return request.post('normal/email/setPwdAgain', { email, ppwd, pwd })
}
